package com.cedric.yixianpai.game.cards.Sects.swordCards.c_JinDan;

import com.cedric.yixianpai.game.Constants.CardType;
import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * 巨鹏灵剑
 * -2spirit
 * 9/12/15 再动
 */
@Component
public class JuPengLingJian extends SwordCard {

    /**
     * 巨鹏灵剑
     * -2spirit
     * 9/12/15 再动
     */
    public JuPengLingJian(@Value("1") int lvl) {
        super("巨鹏灵剑");
        this.setLevel(lvl);
        this.setPeriod(Period.JINDAN);
        this.setDescription("灵气-2 9/12/15攻 再次行动");
        this.setCardType(CardType.LING);

        this.setSpiritNeed(2);
        if(1==lvl){
            this.setDamage(9);
        }else if(2==lvl){
            this.setDamage(12);
        }else if(3==lvl){
            this.setDamage(15);
        }else{
            throw new RuntimeException("卡牌等级错误！");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        if(Sta1.spiritEnough(this.getSpiritNeed())){
            Sta1.attack(Sta2,this.getDamage());
            Sta1.getPlayerBuff().clearSwordIntent();
            if(Sta1.getPlayerBuff().getSpiritualEnergy()>0){
                Sta1.setAgain();//设置再动
            };
            return true;
        }
        return false;
    }
}
